package progma;

import java.util.HashMap;

import progma.lang.compiler.Compiler;
import progma.lang.compiler.CompilerFileWriter;
import progma.lang.compiler.exception.ProgmaSyntaxException;

public class Main {

	private static Compiler compiler = new Compiler();
	
	public static void main(String[] args) throws Exception {
		if(args.length > 0) {
			try {
				HashMap<String, byte[]> files = compiler.compile(args[0]);
				CompilerFileWriter.writeFiles(files);
			} catch(ProgmaSyntaxException pse) {
				System.err.println("Total syntax errors: " + pse.getCount());
				System.exit(1);
			}
		}
	}
}
